package week6;
import java.util.Scanner;
class BankAccount{
    private static int accountCount=1000;
    private String accountNum;
    private String password;
    private double balance;
    private double interestRat;
    private double minBalance;
    public BankAccount(String password,double balance,double interestRat,double minBalance){
        this.accountNum="ACC"+accountCount++;
        this.password=password;
        this.balance=balance;
        this.interestRat=interestRat;
        this.minBalance=minBalance;
    }
    public String getAccountNum(){
        return accountNum;
    }
    public void setPassword(String password){
        this.password=password;
    }
    public double getBalance(){
        return balance;
    }
    public void setBalance(double balance){
        this.balance=balance;
    }

    public double getInterestRat() {
        return interestRat;
    }
    public void setInterestRat(double interestRat){
        this.interestRat=interestRat;
    }
    public double getMinBalance(){
        return minBalance;
    }
    public void setMinBalance(double minBalance){
        this.minBalance=minBalance;
    }
    public String getInfo(){
        return "账号"+accountNum+"，存款余额："+balance+"，利率："+interestRat+"，最小余额："+minBalance;
    }
}
public class TestBank {
    public static void main(String[] args){
        Scanner scanner=new Scanner(System.in);
        BankAccount[] accounts=new BankAccount[3];
        for(int i=0;i<accounts.length;i++){
            System.out.println("请输入第"+(i+1)+"个储户的密码：");
            String pwd=scanner.next();
            System.out.println("请输入存款余额：");
            double balance =scanner.nextDouble();
            System.out.println("请输入利率：");
            double rate =scanner.nextDouble();
            System.out.println("请输入最小余额：");
            double min = scanner.nextDouble();
            accounts[i]=new BankAccount(pwd,balance,rate,min);
        }
        System.out.println("储户信息列表：");
        for(BankAccount acc :accounts){
            System.out.println(acc.getInfo());
        }
        scanner.close();
    }
}
